﻿#if SILVERLIGHT

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace DailyFx.UI
{
  
    /// <summary>
    ///		An <see cref="IValueConverter"/> which converts <see cref="bool"/> to <see cref="Visibility"/>.
    /// </summary>
    public class BooleanToVisibilityConverter : IValueConverter 
	{
        /// <summary>
        ///		Converts a boolean value to a <see cref="Visibility"/> value.
        /// </summary>
        public object Convert ( object value, Type targetType, object parameter, CultureInfo culture )
		{
            return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;
        }

        /// <summary>
        ///		Converts a value <see cref="Visibility"/> value to a boolean value.
        /// </summary>
        public object ConvertBack ( object value, Type targetType, object parameter, CultureInfo culture )
		{
            return ((Visibility)value) == Visibility.Visible;
        }
    }
}
#endif

#if WinRT

using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;


namespace DailyFx.UI
{

    /// <summary>
    ///		An <see cref="IValueConverter"/> which converts <see cref="bool"/> to <see cref="Visibility"/>.
    /// </summary>
    public class BooleanToVisibilityConverter : IValueConverter
    {
        /// <summary>
        ///		Converts a boolean value to a <see cref="Visibility"/> value.
        /// </summary>
        public object Convert ( object value, Type targetType, object parameter, string language )
        {
            return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;
        }

        /// <summary>
        ///		Converts a value <see cref="Visibility"/> value to a boolean value.
        /// </summary>
        public object ConvertBack ( object value, Type targetType, object parameter, string language )
        {
            return ((Visibility)value) == Visibility.Visible;
        }
    }
}
#endif